#ifndef query_helper_h
#define query_helper_h
#include "pool.h"
using namespace mysqlpp;
class ConStack {
public:
	ConStack(Connection* con) {
		this->con = con;
	}
	~ConStack() {
		Pool::Get()->release(con);
	}
	Connection *con;
};
#define QUERY \
	Connection* con = Pool::Get()->grab();\
	ConStack _cst(con);\
	Query q = con->query();

#define catchex(x) {\
	/*LOG << ENDL;*/\
	try {(x); }\
	catch(Exception e) { LOG_ERR << e.what() << ENDL; }\
	catch(...){ LOG_ERR << " something went terribly wrong" << ENDL;}\
}
#endif
